//
//  XDLMSanPostTableViewCell.m
//  xindailianmeng
//
//  Created by 许佳奇 on 17/2/10.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDLMSanPostTableViewCell.h"

@implementation XDLMSanPostTableViewCell
{
    UILabel *_titleLab;
    UIImageView *_imgView;
}
- (void)awakeFromNib {
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUI];
    }
    return self;
}
- (void)setUI
{
       _bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)];
//       [_bgView setBackgroundColor:[UIColor grayColor]];
       [self.contentView addSubview:_bgView];
    
        _titleLab = [self createLabelWithFrame:CGRectMake(15, 10, 100*kscale, 30*kscale) text:@"" textFont:[UIFont systemFontOfSize:16] textColor:[UIColor colorWithRed:102.0/255.0 green:102.0/255.0 blue:102.0/255.0 alpha:1]];
        _titleLab.textAlignment = NSTextAlignmentLeft;
        _imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right"]];
        _imgView.frame = CGRectMake(kScreenW - 15- 9*kscale, 17*kscale, 9*kscale, 17*kscale);
        _imgView.userInteractionEnabled = YES;
        [self addSubview:_imgView];
        [self addSubview:_titleLab];
    
    
}
- (void)reloadData
{

    _imgView.image = [UIImage imageNamed:@"rightcell"];
    _imgView.frame = CGRectMake(kScreenW - 15- 10*kscale, 22*kscale, 6*kscale, 10*kscale);
    [self addSubview:_imgView];
    _titleLab.text = _title;
  
//    UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake(0, 40, kScreenW, 40)];
//    lab.backgroundColor = [UIColor redColor];
//    [self addSubview:lab];
    
    
    

}
-(void)setIsselect:(BOOL)isselect
{
//    if (isselect) {
//        //展开的布局
//        _bgView.frame = CGRectMake(0, 0, 300, 100);
//        UIImageView *borrowImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"repay"]];
//        borrowImg.frame = CGRectMake(15, 60*kscale, 10*kscale, 10*kscale);
//        [_bgView addSubview:borrowImg];
////        UILabel *titleOneLab = [[UILabel alloc] initWithFrame:CGRectMake(29*kscale, 57*kscale, 200, 16)];
//        UILabel *titleOneLab = [self createLabelWithFrame:CGRectMake(29*kscale, 57*kscale, 200, 16*kscale) text:@"借款用途" textFont:[UIFont systemFontOfSize:14] textColor:[UIColor blackColor]];
//        titleOneLab.textAlignment = NSTextAlignmentLeft;
//        [_bgView addSubview:titleOneLab];
//        
//    }
//    else
//    {
//        //未展开布局
//        _bgView.frame = CGRectMake(0, 0, 300, 50);
//    }
}
- (UILabel *)createLabelWithFrame:(CGRect)frame text:(NSString *)text textFont:(UIFont *)font textColor:(UIColor *)color {
    
    UILabel * label = [[UILabel alloc] initWithFrame:frame];
    label.text = text;
    label.textColor = color;
    label.font = font;
    label.adjustsFontSizeToFitWidth = YES;
    label.textAlignment = NSTextAlignmentCenter;
    
    return label;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
